#coding:utf-8
import pymysql
def getConnect():
    try:
        db = pymysql.connect(
            host='localhost',
            port=3306,
            database='xm',
            user='root',
            passwd='09228274a',
            charset='utf8mb4'
        )
        return db
    except pymysql.Error as e:
        print(f"数据库连接错误: {e}")
        return None